<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="utf-8">
    <title>注册账号 - {:config('web_webname')}</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" type="text/css" href="//cdn.istt.cn/cdn/ver/1.0/web/app.css"/>
    <link rel="stylesheet" type="text/css" href="//cdn.istt.cn/cdn/ver/1.0/css/style.css"/>
    <style type="text/css">
        .w400 {
            max-width: 400px;
        }
    </style>
</head>
<body class="o-y bg-bai dk">
<div id="ajaxshow"></div>
<div class="bg-qing dk m0 pt8 pb8 t-c"><h2>注册账号</h2></div>
<div class="container w400 pt8 pb8 t-c">
    <div class="mt5">
        <div class="list p3">
            <div class="input"><span class="input-addon no pl2 f1">* 登陆账号</span><input type="text"
                                                                                       placeholder="请设置一个登陆账号"
                                                                                       class="form no f1" id="user">
            </div>
        </div>
        <div class="list p3">
            <div class="input"><span class="input-addon no pl2 f1">* 登陆密码</span><input type="password"
                                                                                       placeholder="请设置一个登陆密码"
                                                                                       class="form no f1" id="pass">
            </div>
        </div>
        <div class="list p3">
            <div class="input"><span class="input-addon no pl2 f1">* 联系 QQ</span><input type="number" pattern="\d*"
                                                                                        placeholder="请填写您的QQ号码"
                                                                                        class="form no f1" id="qq"
                                                                                        onkeypress="return x.int(this,0,10);">
            </div>
        </div>
        <div class="list p3">
            <div class="input"><span class="input-addon no pl2 f1">* 账号昵称</span><input type="text" pattern="\d*"
                                                                                       placeholder="请填写您的账号昵称"
                                                                                       class="form no f1" id="nick">
            </div>
        </div>
		<div class="list p3">
            <div class="input"><span class="input-addon no pl2 f1">* 联系邮箱</span><input type="email" pattern="\d*"
                                                                                       placeholder="请填写您的邮箱账号"
                                                                                       class="form no f1" id="mail">
            </div>
        </div>
        <div></div>
    </div>
    <button class="btn btn-qing btn-lg btn-block mt7" id="reg">注 册</button>
    <div class="o-h mt7"><span class="fl"><a class="" href="{:url('index/find')}">忘记密码?</a></span> <span
            class="fr"><a class="lan" href="{:url('index/login')}">返回登陆</a></span></div>
    <div class="mt12"><p class="f0 hui">Copyright &copy; 2020 {:config('web_webname')}</p></div>
</div>
<script type="text/javascript" src="/Static/config/js/jquery-2.1.4.min.js"></script>
<script type="text/javascript" src="//cdn.istt.cn/cdn/inc/js/jquery.pjax.min.js"></script>
<script type="text/javascript" src="//cdn.istt.cn/cdn/ver/1.0/web/layer.min.js"></script>
<script src="/Static/config/js/gt.js"></script>
<script src="/Static/config/js/main.js"></script>
<script src="/Static/config/js/app.js"></script>
<script>
	var handler = function (captchaObj) {
            captchaObj.onReady(function () {
            }).onSuccess(function () {
                var user, pass, qq, nick;
				nick = $('#nick').val();
				user = $('#user').val();
				pass = $('#pass').val();
				qq = $('#qq').val();
				mail = $('#mail').val();
				var result = captchaObj.getValidate();
				var result_data = {
					geetest_challenge: result.geetest_challenge,
					geetest_validate: result.geetest_validate,
					geetest_seccode: result.geetest_seccode,
					username: user,
					password: pass,
					nickname: nick,
					qq: qq,
					mail: mail,
					token: (new Date()).getTime()
				};
				var load = x.loading('', true);
				app.ajax("{:url('LoginAjax/UserReg')}", result_data, function (data) {
					layer.close(load);
					if (data.code === 0) {
						if (result) {
							x.loading('注册成功，正在登陆');
							setTimeout(function () {
								window.location.href = "{:url('Index/login')}";
							}, 1000)
						} else {
							x.btn('请先完成验证！');
						}
					} else {
						x.btn(data.msg);
						captchaObj.reset();
					}
				}, '', false);
            });
            $('#reg').click(function () {
                var user, pass, qq, nick, mail;
                nick = $('#nick').val();
                user = $('#user').val();
                pass = $('#pass').val();
                qq = $('#qq').val();
				mail = $('#mail').val();
                if (!user) {
                    $('#user').focus();
                    x.msg("请设置一个登陆账号!");
                    return false;
                }
                if (!pass) {
                    $('#pass').focus();
                    x.msg("请设置一个登陆密码!");
                    return false;
                }
                if (!qq) {
                    $('#qq').focus();
                    x.msg("请填写您的QQ号码!");
                    return false;
                }
                if (!nick) {
                    $('#nick').focus();
                    x.msg("请设置账号昵称!");
                    return false;
                }
				if (!mail) {
                    $('#mail').focus();
                    x.msg("请设置邮箱账号!");
                    return false;
                }
                captchaObj.verify();
            }
            );
        };
        app.ajax("{:url('Common/Geetest_captcha')}?t=" + (new Date()).getTime(), undefined, function (data) {
            initGeetest({
                gt: data.gt,
                challenge: data.challenge,
                offline: !data.success, // 表示用户后台检测极验服务器是否宕机
                new_captcha: data.new_captcha, // 用于宕机时表示是新验证码的宕机
                product: "bind", // 产品形式，包括：float，popup
                width: "190px",
                https: false
            }, handler);
        });
</script>
</body>
</html>